package com.project.listener;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@ControllerAdvice
public class ExceptionPress {

    //如果服务器抛出运行异常执行该方法
    @ExceptionHandler(RuntimeException.class)
    public String pressRuntime(RuntimeException e){
//        return "服务器抛出"+e.getClass().getName()+"异常";
        return "redirect:/html/error.html";
    }
}
